package controller.admin;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;
import com.jfinal.kit.Ret;

import controller.admin.base.BaseAdminController;
import enums.StaffStatus;
import service.StaffService;

public class AdminStaffController extends BaseAdminController {
	@Inject StaffService staffService ;

	public void list() {
	    Kv kv = getParamKv() ;
	    Integer pageNumber = getParaToInt("pageNumber", 1);
	    Integer pageSize = getParaToInt("pageSize", 10);
	    set("page", staffService.getPage( kv , pageNumber, pageSize));
	    set("staffStatusList", StaffStatus.toList());
	    renderJson();
	}

	public void delete() {
        Long id = getParaToLong("id");
        Ret ret = staffService.delete(id);
        renderJson(ret);
    }
	
	public void audit() {
		Long id = getParaToLong("id");
		String reason = getPara("reason");
		boolean isPass = getParaToBoolean("isPass", true);
		renderJson(staffService.audit(id , reason , isPass));
	}
}
